package com.nbjtjc.safe.api.edu;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.nbjtjc.safe.annotation.SysLog;
import com.nbjtjc.safe.bean.Result;
import com.nbjtjc.safe.model.edu.EduEntryTrainingCompany;
import com.nbjtjc.safe.service.edu.EduEntryTrainingCompanyService;

@RestController
@CrossOrigin("*")
@RequestMapping("/eduEntryTrainingCompany")
public class EduEntryTrainingCompanyController {
	@Autowired
	EduEntryTrainingCompanyService eduEntryTrainingCompanyService;
	
	  @RequestMapping(value = "/addOrUpdate",method = {RequestMethod.POST})
	  @SysLog("添加或更新公司培训")
	    public Result add(@RequestBody EduEntryTrainingCompany eduEntryTrainingCompany){
	        Result result=new Result();
	        try {
	            result=eduEntryTrainingCompanyService.add(eduEntryTrainingCompany);
	        } catch (Exception e) {
	            e.printStackTrace();
	            result.setFalse(e.getMessage());
	        }
	        return result;
	    }
	  
	  @RequestMapping(value = "/delete",method = {RequestMethod.POST})
	  @SysLog("删除公司培训")
	    public Result delete(@RequestBody EduEntryTrainingCompany eduEntryTrainingCompany) {
	        Result result=new Result();
	        try {
	            result=eduEntryTrainingCompanyService.delete(eduEntryTrainingCompany.getId());
	        } catch (Exception e) {
	            e.printStackTrace();
	            result.setFalse(e.getMessage());
	        }
	        return result;
	    }
	  

	  @RequestMapping(value = "/find", method = {RequestMethod.POST})
	  public Result find(@RequestBody EduEntryTrainingCompany eduEntryTrainingCompany) {
	        Result result = new Result();
	        try {
	            result = eduEntryTrainingCompanyService.find(eduEntryTrainingCompany);
	        } catch (Exception e) {
	            e.printStackTrace();
	            result.setFalse(e.getMessage());
	        }
	        return result;
	    }
}
